fix(mcp): return structured content for tools with output schemas#97
Merged
Conversation
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR fixes MCP tool call responses for tools that expose an outputSchema, ensuring the server returns structuredContent (in addition to the existing text payload) so MCP SDK clients accept the response.
Changes:
- Detect whether the called tool exposes an
outputSchemaand, if so, includestructuredContentin thecallToolresponse. - Add a regression test asserting
structuredContentis returned for a tool that declares an output schema.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/devframe/src/adapters/mcp/build-server.ts | Adds structuredContent to CallTool responses when an output schema is present. |
| packages/devframe/src/adapters/mcp/tests/mcp-server.test.ts | Extends the MCP adapter test to validate structuredContent is returned alongside text content. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MCP tools that declared an
outputSchemaonly returned text content. MCP SDK clients reject these calls with:Return the tool result through
structuredContentwhenever an output schema is exposed, while preserving the existing text content for compatibility.